package test;

import java.awt.Rectangle;
import java.awt.event.KeyEvent;
import java.util.Random;

@SuppressWarnings("unused")
public class SmallPlane{
	public int x;
	public int y;
	int num=0;
	public final int WIDTH=53;
	public final int HEIGHT=46;
	public static GameStart gs=new GameStart();
	public static GameOver go=new GameOver();
	public SmallPlane(){
			Random ra=new Random();
			int randomNum=ra.nextInt(GameWindows.WIN_WIDTH-68);
			this.x=randomNum;
			this.y=0;
	}
	public void move(){
		this.y+=3;
	}
	public void PlaneMake() {
		if(gs.start&&go.stop==false){
			SmallPlane sp=new SmallPlane();
			GameWindows.spList.add(sp);
		}
	}
	@SuppressWarnings("static-access")
	public boolean hit(MyPlane mp){
		boolean b=false;
		Rectangle spRect=new Rectangle(this.x,this.y,this.WIDTH,this.HEIGHT);
		Rectangle mpRect=new Rectangle(mp.x,mp.y,mp.WIDTH,mp.HEIGHT);
		b=mpRect.intersects(spRect);
		return b;
	}
	public boolean hit1(PlaneTwo pt){
		boolean b=false;
		Rectangle spRect=new Rectangle(this.x,this.y,this.WIDTH,this.HEIGHT);
		Rectangle mpRect=new Rectangle(pt.x,pt.y,pt.WIDTH,pt.HEIGHT);
		b=mpRect.intersects(spRect);
		return b;
	}
}
